﻿namespace ClassyBlog.Web
{
    using System.Collections.Generic;
    using System.Diagnostics;

    public class PagedList<TModel> : ListModel<TModel>
    {
        public PagedList(
            int? currentPage,
            int total,
            int pageSize,
            IEnumerable<TModel> list) : base(list)
        {
            CurrentPage = currentPage ?? 1;
            Total = total;
            PageSize = pageSize;
        }

        public int CurrentPage { get; private set; }

        public int Total { get; private set; }

        public int PageSize { get; private set; }

        public int PageCount
        {
            get { return Pagination.PageCount(Total, PageSize); }
        }

        public bool CanMovePrevious
        {
            [DebuggerStepThrough]
            get { return CurrentPage > 1; }
        }

        public bool CanMoveNext
        {
            [DebuggerStepThrough]
            get { return CurrentPage < PageCount; }
        }
    }
}